package com.sky.rabc.enums;

public enum PayType {
    /**
     * 未选择
     */
    UNSELECTED("unselected","未选择"),
    /**
     * 支付宝
     */
    ALIPAY("alipay","支付宝"),
    /**
     * wx
     */
    WECHAT_PAY("wx","微信支付"),
    /**
     * 信用卡
     */
    CREDIT_CARD("card","信用卡");
    private String code;
    private String description;

    PayType(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static PayType getPayType(String code){
        for (PayType payType : PayType.values()) {
            if (payType.getCode().equals(code)){
                return payType;
            }
        }
        throw new IllegalArgumentException("Invalid code: " + code);
    }
}
